<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    x:Class="OpenLS.Chart.UI.Line3DChartResources"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:chart="http://schemas.Kherty.com/office/2007/chart"
    xmlns:chartui="clr-namespace:OpenLS.Chart.UI"
    xmlns:drawing2="clr-namespace:OpenLS.Drawing.UI;assembly=OpenLS.Drawing.UI"
    xmlns:Internals="clr-namespace:OpenLS.Chart.UI.Internals"
    >
    <DataTemplate DataType="{x:Type chart:Line3DChart}">
        <Grid Style="{x:Static chartui:Panel3DResources.Panel3DStyle}"
                   chartui:ChartElement.XAxisInfo="{Binding Path=Categories.Values.Count, Converter={x:Static Internals:ChartConverters.SimpleAxisInfoFactory}}"
                   chartui:ChartElement.Chart="{Binding}"
                   chartui:ChartElement.ShapePropertiesObserver="{Binding Converter={x:Static Internals:ChartConverters.ShapePropertiesObserverFactory}}"
                   Background="Transparent">
            <Grid.ContextMenu>
                <ContextMenu>
                    <MenuItem Command="{x:Static chartui:ChartCommands.UnformatDataSeries}"/>
                    <MenuItem Command="{x:Static chartui:ChartCommands.Format3DRotation}" />
                    <MenuItem Command="{x:Static chartui:ChartCommands.FormatDataSeries}"/>
                </ContextMenu>
            </Grid.ContextMenu>
            <chartui:Chart3DElement.Projector>
                <MultiBinding Converter="{x:Static Internals:ChartConverters.ProjectorFactory}">
                    <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:ChartElement.ChartArea).View3D.RotationX" />
                    <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:ChartElement.ChartArea).View3D.RotationY" />
                    <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:ChartElement.XAxisInfo).Minimum"/>
                    <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:ChartElement.XAxisInfo).Maximum"/>
                    <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:ChartElement.YAxisInfo).Minimum"/>
                    <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:ChartElement.YAxisInfo).Maximum"/>
                    <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:ChartElement.ZAxisInfo).Minimum"/>
                    <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:ChartElement.ZAxisInfo).Maximum"/>
                    <Binding RelativeSource="{RelativeSource Self}" Path="ActualWidth"/>
                    <Binding RelativeSource="{RelativeSource Self}" Path="ActualHeight"/>
                    <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:ChartElement.ChartArea)" />
                </MultiBinding>
            </chartui:Chart3DElement.Projector>

            <chartui:ChartElement.Observer>
                <MultiBinding Converter="{x:Static Internals:ChartConverters.SeriesObserverFactory}">
                    <Binding Path="Series"/>
                    <Binding Path="Grouping"/>
                </MultiBinding>
            </chartui:ChartElement.Observer>
            <chartui:ChartElement.YAxisInfo>
                <MultiBinding Converter="{x:Static Internals:ChartConverters.AxisInfoFactory}" >
                    <Binding Path="VerticalAxis.Minimum" />
                    <Binding Path="VerticalAxis.Maximum" />
                    <Binding Path="(chartui:ChartElement.Observer).ActualMinimum" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="(chartui:ChartElement.Observer).Maximum" RelativeSource="{RelativeSource Self}"/>
                </MultiBinding>
            </chartui:ChartElement.YAxisInfo>
            <chartui:ChartElement.ZAxisInfo>
                <MultiBinding Converter="{x:Static Internals:ChartConverters.CountAndGroupingToZAxisInfoConverter}">
                    <Binding Path="(chartui:ChartElement.Chart).Series.Count"  RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="(chartui:ChartElement.Chart).Grouping" RelativeSource="{RelativeSource Self}"/>
                </MultiBinding>

            </chartui:ChartElement.ZAxisInfo>
            <chartui:ChartElement.ChartInfo>
                <MultiBinding Converter="{x:Static Internals:ChartConverters.ChartInfoFactory}">
                    <Binding Path="(chartui:ChartElement.XAxisInfo).Minimum" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="(chartui:ChartElement.XAxisInfo).Maximum" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="(chartui:ChartElement.YAxisInfo).Minimum" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="(chartui:ChartElement.YAxisInfo).Maximum" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="(chartui:ChartElement.ZAxisInfo).Minimum" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="(chartui:ChartElement.ZAxisInfo).Maximum" RelativeSource="{RelativeSource Self}"/>
                </MultiBinding>
            </chartui:ChartElement.ChartInfo>

            <ContentPresenter Content="{Binding}" ContentTemplate="{x:Static chartui:ChartBackgroundResources.ChartSurfacesTemplate}"/>
            <ContentPresenter Name="valueAxis"
                chartui:AxisElement.Minimum ="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.YAxisInfo).Minimum}"
                chartui:AxisElement.Maximum ="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.YAxisInfo).Maximum}"
                Content="{Binding VerticalAxis}" ContentTemplate="{x:Static chartui:ValueAxis3DResources.ValueAxis3DTemplate}">
            </ContentPresenter>
            <Grid Name="valueGridLines"
                chartui:AxisElement.Minimum ="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.YAxisInfo).Minimum}"
                chartui:AxisElement.Maximum ="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.YAxisInfo).Maximum}"
                >
                <ContentPresenter Name="minorValueGridLines" ContentTemplate="{x:Static chartui:ChartLine3DResources.ChartLineInfoTemplate}">
                    <chartui:AxisElement.MinorStep>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMinorStepConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                        </MultiBinding>
                    </chartui:AxisElement.MinorStep>
                    <ContentPresenter.Content>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMinorInfoConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.MinorStep)"/>
                            <Binding Path="VerticalAxis"/>
                            <Binding Path="VerticalAxis.MinorGridLines"/>
                        </MultiBinding>
                    </ContentPresenter.Content>
                </ContentPresenter>
                <ContentPresenter ContentTemplate="{x:Static chartui:ChartLine3DResources.ChartLineInfoTemplate}">
                    <chartui:AxisElement.MajorStep>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMajorStepConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                        </MultiBinding>
                    </chartui:AxisElement.MajorStep>
                    <ContentPresenter.Content>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMajorInfoConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.MajorStep)"/>
                            <Binding Path="VerticalAxis"/>
                            <Binding Path="VerticalAxis.MajorGridLines"/>
                        </MultiBinding>
                    </ContentPresenter.Content>
                </ContentPresenter>
            </Grid>
            <ContentPresenter ContentTemplate="{x:Static chartui:ChartLine3DResources.OutlineTemplate}"/>
            <Viewport3D Name="vp" Style="{x:Static chartui:Chart3DViewportResources.Chart3DViewportStyle}">
                <Viewport3D.Camera>
                    <MultiBinding Converter="{x:Static Internals:ChartConverters.CameraConverter}">
                        <Binding ElementName="vp" Path="(chartui:ChartElement.ChartArea).View3D.RotationX"></Binding>
                        <Binding ElementName="vp" Path="(chartui:ChartElement.ChartArea).View3D.RotationY"></Binding>
                        <Binding ElementName="vp" Path="(chartui:ChartElement.XAxisInfo).Minimum"/>
                        <Binding ElementName="vp" Path="(chartui:ChartElement.XAxisInfo).Maximum"/>
                        <Binding ElementName="vp" Path="(chartui:ChartElement.YAxisInfo).Minimum"/>
                        <Binding ElementName="vp" Path="(chartui:ChartElement.YAxisInfo).Maximum"/>
                        <Binding ElementName="vp" Path="(chartui:ChartElement.ZAxisInfo).Minimum"/>
                        <Binding ElementName="vp" Path="(chartui:ChartElement.ZAxisInfo).Maximum"/>
                        <Binding ElementName="Width" Path="Value"></Binding>
                        <Binding ElementName="vp" Path="(chartui:ChartElement.ChartArea)"></Binding>
                        <Binding Source="camera3"></Binding>

                    </MultiBinding>
                </Viewport3D.Camera>
                <ModelVisual3D>
                    <ModelVisual3D.Content>
                        <AmbientLight Color="#555555" />
                    </ModelVisual3D.Content>
                </ModelVisual3D>
                <ModelVisual3D>
                    <ModelVisual3D.Content>
                        <DirectionalLight Color="Gray" Direction="0,-1,-0.3" />
                    </ModelVisual3D.Content>
                </ModelVisual3D>
                <ModelVisual3D>
                    <ModelVisual3D.Content>
                        <DirectionalLight Color="Gray" Direction="0,-1,0.3" />
                    </ModelVisual3D.Content>
                </ModelVisual3D>
                <ModelVisual3D>
                    <ModelVisual3D.Content>
                        <DirectionalLight Color="White" Direction="0, 0, -1" />
                    </ModelVisual3D.Content>
                </ModelVisual3D>
                <ModelVisual3D x:Name="aa">
                    <ModelVisual3D.Content>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.Line3DModelFactory}">
                            <Binding Path="Series"/>
                            <Binding Path="(drawing2:DrawingElement.Theme).ColorScheme" ElementName="vp" />
                            <Binding Path="(chartui:ChartElement.Style)" ElementName="vp"  />
                            <Binding Path="(chartui:ChartElement.Chart).Grouping" ElementName="vp"/>
                            <Binding Path="Shape"/>
                            <Binding Path="(chartui:ChartElement.YAxisInfo).Minimum" ElementName="vp" />
                            <Binding Path="(chartui:ChartElement.YAxisInfo).Maximum" ElementName="vp" />
                            <Binding Path="(chartui:ChartElement.Observer).Generation" ElementName="vp"/>
                            <Binding Path="(chartui:ChartElement.Observer)" ElementName="vp"/>
                            <Binding ElementName="vp" Path="(chartui:ChartElement.ShapePropertiesObserver).Generation" />
                        </MultiBinding>
                    </ModelVisual3D.Content>
                </ModelVisual3D>
            </Viewport3D>

            </Grid>
        
    </DataTemplate>

</ResourceDictionary>